-
-
Notifications
You must be signed in to change notification settings - Fork 33k
GH-132732: Use pure op machinery to optimize various instructions with _POP_TOP
and _POP_TWO
#137577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
_POP_TOP
and _POP_TWO
relevant instructions_POP_TOP
and _POP_TWO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super cool! Just a quick run-through for now:
Misc/NEWS.d/next/Core_and_Builtins/2025-08-09-04-07-05.gh-issue-132732.8BiIVJ.rst
Outdated
Show resolved
Hide resolved
When you're done making the requested changes, leave the comment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool, just one nit.
@brandtbucher Do you want to take another look at this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just a few suggestions for comments and cleaning up the generated code.
Python/optimizer_cases.c.h
Outdated
if (sym_is_const(ctx, res)) { | ||
PyObject *result = sym_get_const(ctx, res); | ||
if (_Py_IsImmortal(result)) { | ||
// Replace with _POP_TOP_LOAD_CONST_INLINE_BORROW since we have one input and an immortal result | ||
REPLACE_OP(this_instr, _POP_TOP_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)result); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still seeing weird indent here, maybe dedent the string in the cases generator?
Uh oh!
There was an error while loading. Please reload this page.